<?php 


/** 
***************************************************
*欢迎使用免费版xSite企业自助建站软件！
*这是一个专业为搜索引擎营销而设计的，极稳定、极易维护的建站软件！
*官方客服：help@php.net.cn
*官方下载网址：http://www.php.net.cn/xsite/ 
***************************************************
**/




 define('SITE_ROOT', str_replace('\\', '/', substr(dirname(__FILE__), 0, -8))); define('SITE_DIR', dirname(dirname(SITE_ROOT))); if (function_exists('date_default_timezone_set')) { date_default_timezone_set('PRC'); } if ($_SERVER['SERVER_PORT'] != 80 || !isset($_SERVER['HTTP_HOST'])) { echo "本软件只能运行在HTTP80端口模式下！"; exit(); } if (!ini_get('short_open_tag')) { echo "你的PHP.INI文件需要启用“short_open_tag”选项才能运行本软件,即必须开启PHP短标记！"; exit(); } if (PHP_VERSION < 5) { echo "自2013年10月1日起后的xSite版本要求PHP5运行环境运行。"; exit(); } @set_time_limit(0); $charset = 'UTF-8'; define('SITE_TPL', SITE_ROOT . "/templates"); require_once SITE_ROOT . "/include/domain.php"; require_once SITE_ROOT . '/include/ThumbLib.inc.php'; require_once SITE_ROOT . "/include/global.inc.php"; require_once SITE_ROOT . "/include/global.class.php"; require_once SITE_ROOT . "/include/template.inc.php"; require_once SITE_ROOT . "/include/db_mysql.php"; if (!INSTALL_STATUS) { go_url("setup.php", "你还没有安装本建站程序，请先执行安装"); } $site_root = SITE_ROOT; $site_path = SITE_PATH; $site_dir = SITE_DIR; define("IN_SITETEAM", true); define("IN_XSITE", true); $home = $site_url = $site_name = $_SERVER['HTTP_HOST']; if (!isset($cache_time)) $cache_time = 600; if ($cache_time > 86400) $cache_time = 86400; define("CACHE_TIME", $cache_time); define('ALLOW_URL_FOPEN', ini_get('allow_url_fopen')); if (!defined('XSITE_MU') || !defined('SITE_HOST')) { $home = $site_url; if (!array_key_exists($site_url, $domain)) { $site_url = "www.{$site_url}"; if (!array_key_exists($site_url, $domain)) { echo "<b>你当前网站只绑定了以下域名，请使用下列域名访问你的网站：</b><br /><br />"; foreach ($domain as $k => $v) { echo "<a href='http://{$k}/" . SITE_PATH . "'>{$k}</a><br />"; } exit_msg("<br />如果你想使用自己新域名访问网站，则请在网站的配置文件“./php.net.cn/xsite/include/domain.php”文件中绑定你的新域名！"); } header("Location: http://{$site_url}{$_SERVER['REQUEST_URI']}"); exit(); } $temp = $domain[$site_url]; unset($domain); $domain[$site_url] = $temp; unset($temp); $config = $domain[$site_url]; unset($config['password']); extract($config); } else { $site_host = SITE_HOST; $home = $site_url; if (!SITE_REWRITE) { exit_msg("xSite企业网站云必须在开启URL Rewrite下运行！"); } if ($site_url == "www." . SITE_HOST || $site_url == SITE_HOST) { if ($site_url == SITE_HOST) { $site_url = "www." . SITE_HOST; header("Location: http://{$site_url}{$_SERVER['REQUEST_URI']}"); exit(); } $temp = $domain[$site_url]; unset($domain); $domain[$site_url] = $temp; unset($temp); $config = $domain[$site_url]; unset($config['password']); extract($config); } else { unset($domain); if (!preg_match('/^[a-z]+/i', $site_url)) { } if (!isset($GLOBALS['db'])) { $db = new db_mysql(); } $db->query("SELECT * FROM xsite_cloud WHERE  site_url = '{$site_url}' LIMIT 1;"); if ($db->total_row) { $domain[$site_url] = $db->fetchRow(); $config = $domain[$site_url]; unset($config['password']); extract($config); } else { exit_msg("你访问的站点还没有建立，在线开通你的网站：<a href='http://www.{$site_host}'>http://www.{$site_host}</a>"); } } } if (!empty($new_domain)) { $page_url = "http://{$new_domain}{$_SERVER['REQUEST_URI']}"; $page_url = url_rewrite($page_url, 'url'); header("Location:{$page_url}"); exit(); } if (!preg_match('/php\.net/', SITE_ROOT)) { exit('PHP System Error!'); } $tpldir = SITE_DIR . "/templates/{$skinid}"; $tplpath = SITE_PATH . "/templates/{$skinid}"; $skinpath = SITE_PATH . "/templates/{$skinid}/images"; $webspider = ''; if (isset($_SERVER['HTTP_USER_AGENT'])) { if (preg_match('/Baiduspider/i', $_SERVER['HTTP_USER_AGENT'])) { $webspider = "Baiduspider"; } elseif (preg_match('/Googlebot/i', $_SERVER['HTTP_USER_AGENT'])) { $webspider = "Googlebot"; } elseif (preg_match('/Sosospider/i', $_SERVER['HTTP_USER_AGENT'])) { $webspider = "Sosospider"; } elseif (preg_match('/Sogou/i', $_SERVER['HTTP_USER_AGENT'])) { $webspider = "Sogou News Spider"; } elseif (preg_match('/bingbot/i', $_SERVER['HTTP_USER_AGENT'])) { $webspider = "Bingbot"; } elseif (preg_match('/360Spider/i', $_SERVER['HTTP_USER_AGENT'])) { $webspider = "360Spider"; } if (!empty($webspider)) { $fp = gzopen(SITE_ROOT ."/data/log/webspider" . date("Ymd", time()) . ".gz", "a9"); $webspider = "{$webspider}\t\tIP:{$_SERVER['REMOTE_ADDR']}\t\tHOST:{$_SERVER['HTTP_HOST']}\t\tPAGE:{$_SERVER['REQUEST_URI']}\t\tTIME:" . time() . "\r\n"; gzwrite($fp, $webspider, strlen($webspider)); gzclose($fp); } } if (isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER'])) { $referer = $_SERVER['HTTP_REFERER']; $parse_url = parse_url($referer); $pathinfo = pathinfo($referer); if (isset($parse_url['query'])) { parse_str($parse_url['query'], $URL_QUERY); } else { $URL_QUERY = null; } $search_engine = ''; $referer_host = isset($parse_url['host']) ? $parse_url['host'] : ""; if (!empty($referer_host) && is_array($URL_QUERY)) { $referer_host = strtolower($referer_host); if (preg_match('/baidu\.com/i', $referer_host)) { $search_words = !empty($URL_QUERY['wd']) ? rawurldecode($URL_QUERY['wd']) : @rawurldecode($URL_QUERY['word']); $search_engine = 'baidu'; } elseif (preg_match('/google\.com/i', $referer_host)) { $search_words = rawurldecode($URL_QUERY['q']); $search_engine = 'google'; } elseif (preg_match('/soso\.com/i', $referer_host)) { $search_words = iconv("gbk", "UTF-8", rawurldecode($URL_QUERY['w'])); $search_engine = 'soso'; } elseif (preg_match('/so\.com/i', $referer_host)) { $search_words = rawurldecode($URL_QUERY['q']); $search_engine = '360so'; } elseif (preg_match('/sogou\.com/i', $referer_host)) { $search_words = rawurldecode($URL_QUERY['query']); $search_engine = 'sogou'; } else { $search_words = ''; } if ($search_words != '') { $fp = gzopen(SITE_ROOT ."/data/log/words" . date("Ymd", time()) . ".gz", "a9"); gzwrite($fp, "IP:" . $_SERVER['REMOTE_ADDR'] . "\t\tEngine:" . $search_engine . "\t\tWords:" . $search_words . "\t\tTime:". date("Y-m-d H:i:s", time()) . "\r\n"); gzclose($fp); define("SEARCH_ENGINE", $search_engine); define("SEARCH_WORDS", $search_words); define("IN_CACHE", false); } } } if (!defined('IN_CACHE')) { define('IN_CACHE', true); } if (isset($_COOKIE['IS_ADMIN']) && $_COOKIE['IS_ADMIN'] == '1') { define('IS_ADMIN', true); } else { define('IS_ADMIN', false); } ?>